﻿var strAddr =new Array();
var NameArray =new Array();
var BarHeight = 160;

function EvenFunt(){
    window.onmousewheel = document.onmousewheel = getScrollTop;
    for (var i =143; i >=0; i--) {
        strAddr[i]="./image/1("+i+").jpg";
        NameArray[i]="店家"+(i+1);
    };
    getScrollTop();
}


var NowShow =0;

function getScrollTop() {
    var ScrollPos;
    if (window.pageYOffset) {
        ScrollPos = window.pageYOffset;
    }else if (document.compatMode && document.compatMode != 'BackCompat'){
        ScrollPos = document.documentElement.scrollTop;
    }else if (document.body) {
        ScrollPos = document.body.scrollTop;
    }
    ScrollPos = parseInt(ScrollPos);
    
    var DomHeight = parseInt(document.getElementById("DOMSHO").style.height);
    var winHeight = parseInt(getWinHeight());
    while(winHeight+ScrollPos>DomHeight-200 && NowShow<strAddr.length){
       DomHeight+=BarHeight;
        document.getElementById("DOMSHO").style.height=DomHeight+"px";
        DomHeight = parseInt(document.getElementById("DOMSHO").style.height);
        document.getElementById("DOMSHO").innerHTML+=getContion(NowShow);
        NowShow++;
    }
}



function getContion(A){
    var Dom="";
 	 var jiage=Math.floor(Math.random()*99);
 	 var shuliang=Math.floor(Math.random()*99);


    Dom+=    "<div style=' padding-top: 10px; padding-left:30px; border:0px;border-top-width:1px; border-color:#FFFFFF; border-style:solid; padding-bottom: 1px; height:150px;background-color: rgba(127,134,131,0.58)'>"

      Dom+=       "<img style ='float:left; text-align: center;width: 140px;height: 140px;' src='"+strAddr[A]+"'>"
     Dom+=        "<div style='width:150px; float:left;'>"
     Dom+=           "<p style ='width:100px; left:10px; color: #060605;margin-top: 20px;'>" +NameArray[A]+"</p>"

    Dom+=                "<p style ='width:100px; left:10px; margin-top: 20px;color: #060605;'>已售" +shuliang+"</p>"
    Dom+=           "<p style ='width:100px; left:10px; margin-top: 20px;color: #060605;'>¥:" +jiage+"</p>"
    Dom+=       "</div>"
    Dom+=   "</div>"

    console.log("%s\n",Dom);
    return Dom;
}


function getWinHeight(){
    if (window.innerHeight)
        return window.innerHeight;
    else if ((document.body) && (document.body.clientHeight))
        return document.body.clientHeight;
}